package crp.core.workflow.domain.expression;

import crp.core.workflow.domain.services.WorkflowCandidateLoadContext;

import java.util.Map;
import java.util.Optional;

public class WorkflowExpressions {
    public static final String ENV_CONTEXT_NAME = "context";

    public static WorkflowCandidateLoadContext context(Map<String, Object> env) {
        return (WorkflowCandidateLoadContext) env.get(ENV_CONTEXT_NAME);
    }

    public static String candidateTopic(String topic) {
        return String.format("/workflow/candidate%s", Optional.ofNullable(topic).orElse(""));
    }
}
